var vm = new Vue({
  el: '#app',
  data: { 
    list: "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),
    sort_list: null,
    select_list:[],
  },
  mounted: function () {
    this.init();
  },
  methods: {
    init: function () {
      if ($.cookie("select_list") != "" && $.cookie("select_list") != "null"&& $.cookie("select_list") != undefined) {
        this.select_list = JSON.parse($.cookie("select_list"));
        console.log(1);
        
      }
      $.ajax({
        url: app.webUrl + "/view/api_activity/typelist",
        data: { type: 2 },
        type: "POST",
        success: function (ret) {
          if (ret.code == '1') {
            console.log(ret);
            vm.sort_list = ret.data;
          }
        }
      });
    },
    link: function (item) {
      window.location.href = "#" + item;
      console.log(111);
    },
    select_type: function (i,i_index) {
      if (this.select_list != null) {
        this.select_list.forEach(function (item, index) {
          if (item == i.name) {
            vm.select_list.splice(index, 1);
          }
        });
      }
      this.select_list.unshift(i);
      $.cookie("select_list", JSON.stringify(this.select_list));
      // 跳转
      this.clickDd(i.name,i.id);
    },
    clean:function(){
      $.cookie("select_list",null);
      this.select_list=[];
    },
    clickDd:function(name,id){
      window.location.href = './hddt.html?&fenleiId='+id+'&name='+name;
    }
  }
}) 